/** @brief Define common functions for multiple test cases. 
 * 
 *  testCommon.h
 *  kangmodb
 *
 *  Created by 강모 김 on 11. 4. 24..
 *  Copyright 2011 강모소프트. All rights reserved.
 *
 */
 
#ifndef _KD_TEST_COMMON_H_
#define _KD_TEST_COMMON_H_ (1)

#include "kdInfra.h"
#include "types.h"
#include "transaction.h"

class stgKangmoDB;
class stgTransaction;
class stgTableCursor;
class stgTable;

KD_VOID setup_cursor(
	stgKangmoDB ** db,
	stgTransaction ** tx,
	stgTableId * tableId,
	stgTableCursor ** cursor );

KD_VOID teardown_cursor(
	stgKangmoDB ** db,
	stgTransaction ** tx,
	stgTableId * tableId,
	stgTableCursor ** cursor );

KD_VOID verify_key_values(stgTableCursor * cursor, int loopCount, const char * keyFormat, const char * valueFormat);

KD_VOID verify_key_value(stgTableCursor * cursor, const char * key, const char * expectedValue);


KD_VOID verify_table_key_values(const stgVersion viewVersion, stgTable * table, int loopCount, const char * keyFormat, const char * valueFormat);

KD_VOID verify_table_key_value(const stgVersion viewVersion, stgTable * table, const char * key, const char * expectedValue);

KD_VOID allocVersion(const char * strData, stgDataVersion ** dataVersion);

KD_VOID freeVersion(stgDataVersion * dataVersion);

bool isDataEqual( stgDataVersion * dataVersion, const char * dataStr);

bool isDataEqual( stgData * data, const char * dataStr);

#endif /*_KD_TEST_COMMON_H_*/